package com.ciwong.epaper.modules.cordva.dao;

import com.ciwong.libs.utils.CWLog;
import com.ciwong.mobilelib.i.BaseCallBack;

/**
 * Created by young on 2016/7/23.
 */
public class CordvaDao {
    private static  CordvaDao instance;
    private CordvaDao(){

    }
    public static CordvaDao getInstance(){
        if(instance==null){
            synchronized (CordvaDao.class){
                if(instance==null){
                    instance=new CordvaDao();
                }
            }
        }

        return instance;
    }
    public void addErrorBook(final String brandId,final String doWorkId,final String typeId,final String packageId,final String cId,final String moduleId,final String versionId,final String resourceName,final String subjectId, final BaseCallBack callBack){
        CordvaRequest.addErrorBook(brandId, doWorkId,typeId,packageId,cId,moduleId,versionId,resourceName,subjectId,new BaseCallBack() {


            @Override
            public void failed(int errorCode, Object data) {

                callBack.failed(errorCode,data);
                CWLog.d("Volley","========="+errorCode);
            }

            @Override
            public void failed(Object data) {
                callBack.failed(data);
                CWLog.d("Volley","========="+String.valueOf(data));

            }

            @Override
            public void success(Object data) {
                // BindInfo bindInfo=(BindInfo) data;
                // CWLog.d("Volley",bindInfo.getMobile().toString());
                callBack.success(data);
            }
        });
    }

    public void selectErrorBook(final String brandId,final String pIndex,final String psize,final String subjectId, final BaseCallBack callBack){
        CordvaRequest.selectErrorBook(brandId, pIndex,psize,subjectId,new BaseCallBack() {


            @Override
            public void failed(int errorCode, Object data) {

                callBack.failed(errorCode,data);
                CWLog.d("Volley","========="+errorCode);
            }

            @Override
            public void failed(Object data) {
                callBack.failed(data);
                CWLog.d("Volley","========="+String.valueOf(data));

            }

            @Override
            public void success(Object data) {
                // BindInfo bindInfo=(BindInfo) data;
                // CWLog.d("Volley",bindInfo.getMobile().toString());
                callBack.success(data);
            }
        });
    }

    public void delectErrorBook(final String brandId,final String versionId, final BaseCallBack callBack){
        CordvaRequest.delectErrorBook(brandId, versionId,new BaseCallBack() {


            @Override
            public void failed(int errorCode, Object data) {

                callBack.failed(errorCode,data);
                CWLog.d("Volley","========="+errorCode);
            }

            @Override
            public void failed(Object data) {
                callBack.failed(data);
                CWLog.d("Volley","========="+String.valueOf(data));

            }

            @Override
            public void success(Object data) {
                // BindInfo bindInfo=(BindInfo) data;
                // CWLog.d("Volley",bindInfo.getMobile().toString());
                callBack.success(data);
            }
        });
    }




}
